package com.fanfan.controller;

import com.fanfan.pojo.domain.ResponseResult;
import com.fanfan.pojo.vo.AddArticleDto;
import com.fanfan.pojo.vo.TagVo;
import com.fanfan.service.ArticleService;
import com.fanfan.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/content")
public class WriteArticleController {
    @Autowired
    private TagService tagService;

    @Autowired
    private ArticleService articleService;

    @GetMapping("/tag/listAllTag")
    public ResponseResult listAllTag(){
        List<TagVo> list = tagService.listAllTag();
        return ResponseResult.okResult(list);
    }
    @PostMapping("/article")
    public ResponseResult add(@RequestBody AddArticleDto article){
        return articleService.add(article);
    }
}
